import { NavigationEnd, Router } from '@angular/router';
import { Component, OnInit } from '@angular/core';
import 'rxjs/add/operator/filter';
@Component({
  selector: 'app-main-content',
  templateUrl: './main-content.component.html',
  styleUrls: ['./main-content.component.css']
})
export class MainContentComponent implements OnInit {

  pageTitle = '';
  pageDesc = '';

  constructor(private routerInfo:Router) {
    routerInfo.events.filter(event => event instanceof NavigationEnd)
    .subscribe((events:NavigationEnd)=>{
      if(events.url =='/dashboard'){
        this.pageTitle='首页';
        this.pageDesc=''
      }else if(events.url.startsWith('/stock')){
        this.pageTitle='股票管理页面';
        this.pageDesc='基本增删改查';
      }else if(events.url=='/'){
        this.pageTitle='首页';
        this.pageDesc='';
      }
    })
  }

  ngOnInit() {


  }

}

